package action;


import java.util.Iterator;
import java.util.List;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Query;
import org.hibernate.Session;

import po.*;

import bean.EmailBean;
import bo.HibernateSessionFactory;

import com.opensymphony.xwork2.ActionSupport;

public class EmailDeletedM extends ActionSupport{
	
	
	public String execute(){

			Session session = HibernateSessionFactory.getSession();
			Query q = session.createQuery("from Email e where ( e.acceptflag='5' or e.acceptflag='1' ) and e.sendflag = '5' ");
			List list = q.list();
			Iterator it = list.iterator();
			while(it.hasNext()){
				Email e = (Email)it.next();
				session.delete(e);
			}
			session.beginTransaction().commit();
				

			return "EmailDeleted";
		} 
		

		
	}


	

